package com.journey.org.ui.search.gank

import android.os.Bundle
import com.journey.org.entity.SearchGankEntity
import com.journey.org.ui.video.broadcast.BroadcastActivity
import com.journey.org.ui.web.WebActivity
import com.mvvmhabit.org.base.ItemViewModel
import com.mvvmhabit.org.binding.command.BindingAction
import com.mvvmhabit.org.binding.command.BindingCommand

/**
 * @Date: 2020/11/19 10:46
 * @Author:小妖
 * @Description: 干货-搜索
 */
class GankSearchItemViewModel(VM: GankSearchViewModel, val entity: SearchGankEntity) :
    ItemViewModel<GankSearchViewModel>(VM) {

    val onEnterDetailCommand = BindingCommand<Any>(object : BindingAction {
        override fun call() {
            val bundle = Bundle()
            bundle.putString("loadUrl", "https://gank.io/post/" + entity._id)
            bundle.putString("title", entity.title)
            viewModel.startActivity(WebActivity::class.java, bundle)
        }
    })
}